Apply new resharper refactoring "Redundant dereferencing and taking address"
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Fri, 8 Sep 2023 23:06:32 +0000 (17:06 -0600)
committertsteven4 <13596209+tsteven4@users.noreply.github.com>
Fri, 8 Sep 2023 23:06:32 +0000 (17:06 -0600)
geojson.cc
googletakeout.cc
jeeps/gpsread.cc

index 1c914dcdfad355bc876156b1540b8875ad65046c..6c5e60c51543c5a82b7c7f5723288f265d24ddb6 100644 (file)
@@ -249,7 +249,7 @@ void GeoJsonFormat::geojson_track_disp(const Waypoint* trackpoint) const
   if (trackpoint->altitude != unknown_alt && trackpoint->altitude != 0) {
     coords.append(trackpoint->altitude);
   }
-  (*track_coords).append(coords);
+  track_coords->append(coords);
 }
 
 void GeoJsonFormat::geojson_track_tlr(const route_head* /*unused*/)
index a962aa49ca5ee094eca15e0dc69367a7a911c9c8..d4b82f88231b5c89a04ed3e5b36c32532c6760e2 100644 (file)
@@ -68,13 +68,13 @@ static Waypoint* takeout_waypoint(
   Waypoint* waypoint = new Waypoint();
   waypoint->latitude = lat_e7 / 1e7;
   waypoint->longitude = lon_e7 / 1e7;
-  if (shortname && (*shortname).length() > 0) {
+  if (shortname && shortname->length() > 0) {
     waypoint->shortname = *shortname;
   }
-  if (description && (*description).length() > 0) {
+  if (description && description->length() > 0) {
     waypoint->description = *description;
   }
-  if (start_str && (*start_str).length() > 0) {
+  if (start_str && start_str->length() > 0) {
     gpsbabel::DateTime start = QDateTime::fromString(*start_str, Qt::ISODate);
     waypoint->SetCreationTime(start);
   }
index 7dbeb76ec6b20607c52bfdad7a2b630bfec7a8fa..512c647af9c836dd81a27f02692c2f45426e544b 100644 (file)
@@ -79,7 +79,7 @@ int32 GPS_Serial_Packet_Read(gpsdevh* fd, GPS_PPacket* packet)
   const char* m1;
   const char* m2;
   bool isDLE = false;
-  p = (*packet).data;
+  p = packet->data;
 
   start = GPS_Time_Now();
   GPS_Diag("Rx Data:");
@@ -105,7 +105,7 @@ int32 GPS_Serial_Packet_Read(gpsdevh* fd, GPS_PPacket* packet)
       }
 
       if (len == 1) {
-        (*packet).type = u;
+        packet->type = u;
         ++len;
         continue;
       }
@@ -119,14 +119,14 @@ int32 GPS_Serial_Packet_Read(gpsdevh* fd, GPS_PPacket* packet)
       }
 
       if (len == 2) {
-        (*packet).n = u;
+        packet->n = u;
         len = -1;
         continue;
       }
 
       if (u == ETX)
         if (isDLE) {
-          if (p - (*packet).data - 2 != (*packet).n) {
+          if (p - packet->data - 2 != packet->n) {
             GPS_Error("GPS_Packet_Read: Bad count");
             gps_errno = FRAMING_ERROR;
             return 0;
@@ -134,7 +134,7 @@ int32 GPS_Serial_Packet_Read(gpsdevh* fd, GPS_PPacket* packet)
           chk_read = *(p - 2);
 
           unsigned int i;
-          for (i = 0, p = (*packet).data; i < (*packet).n; ++i) {
+          for (i = 0, p = packet->data; i < packet->n; ++i) {
             chk -= *p++;
           }
           chk -= packet->type;
@@ -145,17 +145,17 @@ int32 GPS_Serial_Packet_Read(gpsdevh* fd, GPS_PPacket* packet)
             return 0;
           }
 
-          m1 = Get_Pkt_Type((*packet).type, (*packet).data[0], &m2);
+          m1 = Get_Pkt_Type(packet->type, packet->data[0], &m2);
           if (gps_show_bytes) {
             GPS_Diag(" ");
             for (unsigned j = 0; j < packet->n; j++) {
-              char c = (*packet).data[j];
+              char c = packet->data[j];
               GPS_Diag("%c", isascii(c) && isalnum(c) ? c : '.');
             }
             GPS_Diag(" ");
           }
           GPS_Diag("(%-8s%s)\n", m1, m2 ? m2 : "");
-          return (*packet).n;
+          return packet->n;
         }
 
       if (p - packet->data >= MAX_GPS_PACKET_SIZE) {
@@ -193,12 +193,12 @@ bool GPS_Serial_Get_Ack(gpsdevh *fd, GPS_PPacket *tra, GPS_PPacket *rec)
     return false;
   }
 
-  if (LINK_ID[0].Pid_Ack_Byte != (*rec).type) {
+  if (LINK_ID[0].Pid_Ack_Byte != rec->type) {
     gps_error = FRAMING_ERROR;
     /* rjl     return 0; */
   }
 
-  if (*(*rec).data != (*tra).type) {
+  if (*rec->data != tra->type) {
     gps_error = FRAMING_ERROR;
     return false;
   }